// js 执行主线程 main.js
navigator.serviceWorker.register("sw.js").then(function (registration) {
  console.log("Registered events at scope: ", registration.scope);
  if (registration.waiting) {
    // Service Worker is Waiting
  }
  if (registration.active) {
    // Service Worker is Active
  }
});
